﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Fuse8.ContentManagementFramework.SystemFacade.Globalization;

namespace Fuse8.ContentManagementFramework.Administration.Attributes
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class GlobalizedRegularExpAttribute : RegularExpressionAttribute
    {
        public GlobalizedRegularExpAttribute(string pattern, string name, string domain) : base(pattern)
        {
            ErrorMessage = GlobalizationFacade.Current.WithDomain(domain, CultureInfo.CurrentUICulture).GetText(name);
        }
    }
}